- [Starting the REPL](#starting-the-repl)
- [Show sml command help](#show-sml-command-help)
- [Inside REPL](#inside-repl)
  - [Loading a program](#loading-a-program)
  - [Opening a library](#org2e8f4e5)
  - [Directories](#directories)
    - [Current directory](#current-directory)
    - [Change directory](#change-directory)
- [Use compilation manager](#compilation-manager)
- [Exiting the REPL](#exiting-the-repl)
- [More info](#more-info)



<a id="starting-the-repl"></a>

# Starting the REPL

```shell
sml
```


<a id="show-sml-command-help"></a>

# Show sml command help

```shell
sml -h
```


<a id="inside-repl"></a>

# Inside REPL


<a id="loading-a-program"></a>

## Loading a program

Corresponding to `(load "file.scm")` in Scheme:

```sml
use "filename";
```


<a id="org2e8f4e5"></a>

## Opening a library

Opening a library will introduce its bindings into the current environment:

```sml
open "filename";
(* or *)
open structure_name;
```


<a id="directories"></a>

## Directories


<a id="current-directory"></a>

### Current directory

```sml
OS.FileSys.getDir();
```


<a id="change-directory"></a>

### Change directory

```sml
OS.FileSys.chDir("filename");
```


<a id="compilation-manager"></a>

# Use compilation manager

```sml
CM.make "file.cm";
```

Find more info at <https://www.smlnj.org/doc/CM/index.html>.


<a id="exiting-the-repl"></a>

# Exiting the REPL

Either use `C-d` or run the following code:

```sml
OS.Process.exit(OS.Process.success);
```


<a id="more-info"></a>

# More info

Some links:

-   <https://www.smlnj.org/doc/FAQ/usage.html>